class Solution {
public:
vector<vector<int>> flipAndInvertImage(vector<vector<int>>& A) {


	for (int i = 0; i<A.size(); i++)
	{
		vector<int>& vec = A[i];
		for (int j = 0; j<A.size(); j++)
		{
			vec[j] = vec[j] ^ 1;
		}
        std::reverse(vec.begin() , vec.end());
	}
	
	std::reverse(A.begin() , A.end());
	return A;
}
};